<?php 
$webroot="";
if(session::is_manager()==TRUE)
{
	require_once 'html/admintemplate.php';
}
else 
{
	require_once 'html/template.php';
}

?>
<table border="1" bordercolor="#F0FFFF" width="100%">

<?php if(session::is_manager()==TRUE)
{
?>
<tr>
<td colspan="5" class="classmenu">
Payment History
</td>
</tr>
<tr class="classtopmenu">
		<td>
		Paymentid
		</td>
		<td>
		Date
		</td>
		<td>
		UserName
		</td>
		<td>
		Amount
		</td>
		<td>
		Reason
		</td>
		</tr>
<?php
}
else
{
	?>
	<tr>
<td colspan="4" class="classmenu">
Payment History
</td>
</tr>
<tr class="classtopmenu">
		<td>
		Order
		</td>
		<td>
		Date
		</td>
		<td>
		Amount
		</td>
		<td>
		Reason
		</td>
		</tr>
	<?php 
}
?>
<tr>
<td colspan=5>
Pages: 
<?php 
/**
for($idpage=1;$idpage<=$pagesnum;$idpage++)
{
	if($idpage==$Page_id)
	{
		$Show="<b>$idpage</b>";
	}
	else 
	{
		$Show=$idpage;
	}
	echo "<a href=paymenthistory.php?pagesid=$idpage>$Show </a>";
}
*/
if($pagesnum-$Page_id<5)
{
	$pageMax=$pagesnum;
}
else
{
	$pageMax=$Page_id+5;
}

if($Page_id<=5)
{
	$pageMin=1;
}
else
{
	$pageMin=$Page_id-5;
}
$idPageNext=$Page_id+1;
$idPageEnd=$pagesnum;
$idPageFirst=1;
echo "<a href=orderhistory.php?pagesid=$idPageFirst>First Page</a> ";
for($idpage=$pageMin;$idpage<=$pageMax;$idpage++)
{
	if($idpage==$Page_id)
	{
		$Show="<b>$idpage</b>";
	}
	else 
	{
		$Show=$idpage;
	}
	echo "<a href=paymenthistory.php?pagesid=$idpage>$Show </a>";
}
echo "<a href=paymenthistory.php?pagesid=$idPageNext>Next Page</a> ";
echo "<a href=paymenthistory.php?pagesid=$idPageEnd>Last Page</a>";
?>
</td>
</tr>
<?php 
$i=1;
if($Page_id>1)
{
	$i=($Page_id-1)*$size;
}
foreach($GetHistoryPayment as $ShowHistory)
{
	
	if(session::is_manager()==TRUE)
	{
	?>
	<tr>
	<td>
	<?php echo $ShowHistory['paymentid'];?>
	</td>
	<td>
	<?php echo $ShowHistory['date'];?>
	</td>
	<td>
	<?php echo $ShowHistory['username'];?>
	</td>
	<td>
	<?php echo "<b>".$ShowHistory['amount']."</b>";?>
	</td>
	<td>
	<?php echo $ShowHistory['reason'];?>
	</td>
	</tr>
	<?php 
	}
else if(session::is_member()==TRUE)
	{
	?>
	<tr>
	<td>
	<?php echo $i;?>
	</td>
	<td>
	<?php echo $ShowHistory['date'];?>
	</td>
	<td>
	<?php echo "<b>".ceil($ShowHistory['amount'])."</b>";?>
	</td>
	<td>
	<?php echo $ShowHistory['reason'];?>
	</td>
	</tr>
	<?php 
	$i++;
	}
	
}

?>

</table>